<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:ui ="clr-namespace:Bookvar.UI"
	>
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Shared.xaml" />
  </ResourceDictionary.MergedDictionaries>

  <Style TargetType="ui:ToggleImageButton">
    <Setter Property="CornerRadius" Value="2"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Padding" Value="4"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="ui:ToggleImageButton">
          <Grid>
            <Border
              BorderThickness="{TemplateBinding BorderThickness}"
              BorderBrush="{TemplateBinding BorderBrush}"
              CornerRadius="{TemplateBinding CornerRadius}"
              Background="{TemplateBinding Background}">
              <Grid>
                <StackPanel Name="spnlUnchecked" ToolTip="{TemplateBinding UncheckedTooltip}">
                  <Image Name="imgUnchecked" Source="{TemplateBinding UncheckedImageSource}" />
                  <TextBlock Text="{TemplateBinding UncheckedText}" />
                </StackPanel>
                <StackPanel Name="spnlChecked" ToolTip="{TemplateBinding CheckedTooltip}">
                  <Image Name="imgChecked"  Source="{TemplateBinding CheckedImageSource}" />
                  <TextBlock Text="{TemplateBinding CheckedText}" />
                </StackPanel>
              </Grid>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="spnlUnchecked"
                      Property="Visibility"
                      Value="Collapsed" />
              <Setter TargetName="spnlChecked"
                      Property="Visibility"
                      Value="Visible" />
            </Trigger>
            <Trigger Property="IsChecked" Value="False">
              <Setter TargetName="spnlUnchecked"
                      Property="Visibility"
                      Value="Visible" />
              <Setter TargetName="spnlChecked"
                      Property="Visibility"
                      Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="{x:Null}">
              <Setter TargetName="spnlUnchecked"
                      Property="Visibility"
                      Value="Visible" />
              <Setter TargetName="spnlChecked"
                      Property="Visibility"
                      Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" Value="{StaticResource LightBackGroundBrush}"/>
              <Setter Property="BorderBrush" Value="{StaticResource LightBorderBrush}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Background" Value="{StaticResource PlusLightBackGroundBrush}" />
              <Setter Property="BorderBrush" Value="{StaticResource PlusLightBorderBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>